; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=csky -mattr=+fpuv2_sf,+fpuv2_df,+hard-float -float-abi=hard -verify-machineinstrs -csky-no-aliases < %s \
; RUN:   | FileCheck -check-prefix=CSKYF %s

@gd = external global double

define double @constraint_f_double(double %a) nounwind {
; CSKYF-LABEL: constraint_f_double:
; CSKYF:       # %bb.0:
; CSKYF-NEXT:    subi16 sp, sp, 4
; CSKYF-NEXT:    lrw32 a0, [.LCPI0_0]
; CSKYF-NEXT:    fldd vr1, (a0, 0)
; CSKYF-NEXT:    #APP
; CSKYF-NEXT:    faddd vr0, vr0, vr1
; CSKYF-NEXT:    #NO_APP
; CSKYF-NEXT:    addi16 sp, sp, 4
; CSKYF-NEXT:    rts16
; CSKYF-NEXT:    .p2align 1
; CSKYF-NEXT:  # %bb.1:
; CSKYF-NEXT:    .p2align 2
; CSKYF-NEXT:  .LCPI0_0:
; CSKYF-NEXT:    .long gd

  %1 = load double, double* @gd
  %2 = tail call double asm "faddd $0, $1, $2", "=v,v,v"(double %a, double %1)
  ret double %2
}

define double @constraint_f_double_abi_name(double %a) nounwind {
; CSKYF-LABEL: constraint_f_double_abi_name:
; CSKYF:       # %bb.0:
; CSKYF-NEXT:    subi16 sp, sp, 4
; CSKYF-NEXT:    lrw32 a0, [.LCPI1_0]
; CSKYF-NEXT:    fldd vr3, (a0, 0)
; CSKYF-NEXT:    fmovd vr2, vr0
; CSKYF-NEXT:    #APP
; CSKYF-NEXT:    faddd vr1, vr2, vr3
; CSKYF-NEXT:    #NO_APP
; CSKYF-NEXT:    fmovd vr0, vr1
; CSKYF-NEXT:    addi16 sp, sp, 4
; CSKYF-NEXT:    rts16
; CSKYF-NEXT:    .p2align 1
; CSKYF-NEXT:  # %bb.1:
; CSKYF-NEXT:    .p2align 2
; CSKYF-NEXT:  .LCPI1_0:
; CSKYF-NEXT:    .long gd

  %1 = load double, double* @gd
  %2 = tail call double asm "faddd $0, $1, $2", "={fr1},{fr2},{fr3}"(double %a, double %1)
  ret double %2
}
